import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { RouteReuseStrategy } from '@angular/router';
import { HttpClientModule,HttpClient} from '@angular/common/http';
import { WebView } from '@ionic-native/ionic-webview/ngx';
import { FormsModule,ReactiveFormsModule } from '@angular/forms';
import { TranslateModule,TranslateLoader } from "@ngx-translate/core";
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { FingerprintAIO } from '@ionic-native/fingerprint-aio/ngx';
import { Device } from '@ionic-native/device/ngx';
import { Camera } from '@ionic-native/camera/ngx';
import { ImagePicker } from '@ionic-native/image-picker/ngx';
import { httpInterceptorProviders } from './http-interceptors/index';
import { LocalNotifications } from '@ionic-native/local-notifications/ngx';
import { Toast } from '@ionic-native/toast/ngx';

import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import { Keyboard } from '@ionic-native/keyboard/ngx';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { Badge } from '@ionic-native/badge/ngx';
import { BaiduPush } from '@ionic-native/baidu-push/ngx';
import { DragDropModule } from '@angular/cdk/drag-drop';

/* service start */
import { RegisterButtonService } from './services/register-button.service';
import { AuthTokenService } from './services/auth-token.service';
import { DefaultLanguageService } from './services/default-language.service';
import { EncryptService } from './services/encrypt.service';
import { EventEmitterService } from './services/event-emitter.service';
import { CommonService } from './services/common-service.service';
import { CustomToastProviderService } from '@common-components/common-toast/custom-toast-provider.service';
/* service end */

/* guard start */
import { LoginGuard } from '@guard/loginGuard';
/* guard start */

/* common customized module start*/
import { CommonToastPageModule } from '@common-components/common-toast/common-toast.module';
/* common customized module end*/

/* common customized components start*/
import { CommonToastComponent } from "@common-components/common-toast/common-toast.component";
/* common customized components end*/
import { AndroidPermissions } from '@ionic-native/android-permissions/ngx';

import {MatSnackBarModule} from '@angular/material/snack-bar';
// required for AOT compilation
export function HttpLoaderFactory(httpClient: HttpClient) {
  return new TranslateHttpLoader(httpClient);
}

@NgModule({
  declarations: [AppComponent],
  entryComponents: [CommonToastComponent],
  imports: [
    DragDropModule,
    BrowserModule,
    HttpClientModule,
    FormsModule,
    ReactiveFormsModule,
    CommonToastPageModule,
    IonicModule.forRoot({
      mode:'ios',
      backButtonText:'',
      swipeBackEnabled:false,
      animated:false
    },
  ), 
  AppRoutingModule,
  TranslateModule.forRoot({
    loader: {
      provide: TranslateLoader,
      useFactory: HttpLoaderFactory,
      deps: [HttpClient]
    }
  }),
  BrowserAnimationsModule,
  MatSnackBarModule
],
  providers: [
    AndroidPermissions,
    StatusBar,
    Keyboard,
    SplashScreen,
    { provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
    FingerprintAIO,
    Device,
    WebView,
    httpInterceptorProviders,
    LocalNotifications,
    Badge,
    BaiduPush,
    Toast,
    Camera,
    ImagePicker,
    RegisterButtonService,
    AuthTokenService,
    DefaultLanguageService,
    EncryptService,
    EventEmitterService,
    CommonService,
    CustomToastProviderService,
    LoginGuard 
  ],
  bootstrap: [AppComponent]
})
export class AppModule {}
